package com.hm.controller;

import com.hm.pojo.HmActivity;
import com.hm.serivce.HmActivityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(value = "活动版块接口",tags = "活动模块接口")
public class HmActivityController {

    @Autowired
    private HmActivityService hmActivityService;

    /**
     * 活动模块，全查出活动列表，展示活动列表
     * @return
     */
    @RequestMapping(value = "ActivityList",method = RequestMethod.GET)
    @ApiOperation(value = "活动列表接口")
    public List<HmActivity> ActivityList(){
        List<HmActivity> list = hmActivityService.ActivityList();
        return  list;
    }

    /**
     * 根据id查询单个活动信息
     * @param id
     * @return
     */
    @RequestMapping(value = "getActivityByID",method = RequestMethod.POST)
    @ApiOperation(value = "单个活动接口")
    public HmActivity getActivityByID(int id){
        HmActivity hmActivity = hmActivityService.getActivityByID(id);
        return hmActivity;
    }
}
